import {request} from "./index"

/** 申请经销商
 * 
 * @param {object} data
 * @param {string} data.name
 * @param {string} data.idNumber
 * @param {string} data.settlementBankAccountName
 * @param {string} data.settlementBankAccountNum
 * @param {string} data.settlementBankBranchName
 * @param {string} data.superiorDistributor
 * @param {string} token
 * 
 */
const applyDealer = (data, token) => {
  return request.postFrom(`v1/app/distribution/distribution`, data, {
    "Authorization": token,
    "content-type": "application/x-www-form-urlencoded"
  })
}

/** 获取本人经销商信息
 * 
 * @param {string} token
 * 
 */
const getMyDealerInfo = (token) => {
  return request.get(`v1/app/distribution/distribution`, {}, {
    "Authorization": token
  })
}

/** 绑定关系
 * 
 * @param {string} distributionId
 * @param {string} token
 * 
 */
const bindDealer = (distributionId, token) => {
  return request.get(`v1/app/distribution/distribution/bindingDistribution/${distributionId}`, {}, {
    "Authorization": token
  })
}

/** 查看客户列表
 * 
 * @param {string} distributionId
 * @param {number} page
 * @param {string} token
 * 
 */
const checkInfoList = (distributionId, page, token) => {
  return request.get(`v1/app/distribution/distribution/info/${distributionId}`, {
    page
  }, {
    "Authorization": token
  })
}

/** 获取分销订单
 * 
 * @param {number} page
 * @param {string} token
 * 
 */
const dealerOrder = (page, token) => {
  return request.get(`v1/app/distribution/order`, {
    page
  }, {
    "Authorization": token
  })
}



export {
  applyDealer,
  getMyDealerInfo,
  bindDealer,
  checkInfoList,
  dealerOrder
}